
export function pyFormat(value: any): string {
  if (Object.prototype.toString.call(value) === '[object String]') {
    return `"${value}"`
  }
  else if (Object.prototype.toString.call(value) === '[object Number]') {
    return `${value}`
  }
  else if (Object.prototype.toString.call(value) === '[object Object]') {
    return JSON.stringify(value)
  }
  else if (Object.prototype.toString.call(value) === '[object Boolean]') {
    return value ? 'True' : 'False'
  }
  else if (Object.prototype.toString.call(value) === '[object Array]') {
    const _v = value as any[]
    return `[${_v.map(x => pyFormat(x)).join(', ')}]`
  }
  else {
    console.error(value);
    throw new Error('pyFormat: 未知的进数据类型')
  }
}